# 元组，内容不可以修改， 只读的list
t1 = (1, 'hello', True)
t2 = ()
t3 = tuple()
print(type(t1), t1)  # <class 'tuple'>
print(t1[0])
# 单个元素时，写上逗号 ,
t4 = ("hello",)
print(type(t4), t4)
t5 = ((1, 2, 3), (4, 5, 6))
print(type(t5), t5)
print(t5[1][2])

t6 = ('传智教育', 'heima', 'cxy', 'python', 'linux')
index = 0
while index < len(t6):
    print(t6[index])
    index += 1

for i in t6:
    print(i)

# 元组里面的list内容可以修改
t7 = (1, 2, 3, ['itheima', 'python'])
t7[3][0] = 'itcast'
print(t7)  # (1, 2, 3, ['itcast', 'python'])

